from likeshop_api_project.api.login_api import login_model
from likeshop_api_project.base.mybase import Tools


# 商品收藏
class commodity_collection_model(Tools):
    path = '/api/collect/handleCollectGoods'

    def commodity_collection_action(self, is_collect, goods_id, hd):
        commodity_collection_data = {
            "is_collect": is_collect,
            "goods_id": goods_id
        }
        commodity_collection = self.huihua.post(url=self.hosturl+self.path, data=commodity_collection_data, headers=hd)
        return commodity_collection.json()



if __name__ == '__main__':
    import requests

    s = requests.session()
    reg = login_model(huihua=s)
    msg = reg.login_action(account="13356786546", password="rr98765", client=2)
    # print(msg)
    get_token = msg["data"]["token"]
    # print(get_token)
    hd = {"token": get_token}

    commodity_collection = commodity_collection_model(huihua=s)
    msg = commodity_collection.commodity_collection_action(is_collect=1, goods_id=6, hd=hd)
    print(msg)
